home *** CD-ROM | disk | FTP | other *** search
/ Internet Surfer 2.0 / Internet Surfer 2.0 (Wayzata Technology) (1996).iso / pc / text / mac / faqs.556 < prev    next >
Encoding:
Text File  |  1996-02-12  |  14.7 KB  |  352 lines

  1. Frequently Asked Questions (FAQS);faqs.556
  2.  
  3.  
  4.  
  5.   Oliver Jones (oj@roadrunner.pictel.com):
  6.     Keep fonts local to the workstation, rather than loading them over nfs.
  7.     If you will make extensive use of R5 scalable fonts, use a font server.
  8.  
  9. About the Resources File
  10. - - - - - - - - - - - - -
  11.  
  12.   Joe English (joe@trystero.art.com) :
  13.     Keep your .Xresources and .Xdefaults file small.  Same effect as
  14.     [reducing the number of fonts].
  15.  
  16.   In your .Xdefaults (.Xresources) file, try just putting the minimum
  17.   amount of resources that you want to have available to all your
  18.   applications.  For example:  *reverseVideo: true
  19.  
  20.   Then, separate your resources into individual client-specific
  21.   resource files.  For Example: I store mine in $HOME/lib/app-defaults.
  22.   In my .login file I set the environment variable XUSERFILESEARCHPATH:
  23.       setenv XUSERFILESEARCHPATH $HOME/lib/app-defaults/%N
  24.  
  25.   So, when I launch an xterm, it loads its resources from
  26.   ...app-defaults/XTerm.  Xdvi finds them in .../app-defaults/XDvi,
  27.   and so on and so forth.  Not all clients follow the same class-naming
  28.   convention, so you may have some fun figuring out what to call the
  29.   resource file (xterm? Xterm? XTerm?).  In general, try following the
  30.   standard XXxxx pattern first.
  31.  
  32.   This method of organizing your personal resources has the following
  33.   benefits:
  34.  
  35.   - Easier to maintain/ more usable.
  36.  
  37.   - Fewer resources are stored in the X server in the RESOURCE_MANAGER
  38.     property.  As a side benefit your server may start fractionally
  39.     quicker, since it doesn`t have to load all your resources.
  40.  
  41.   - Applications only process their own resources, never have to sort
  42.     through all of your resources to find the ones that affect them.
  43.  
  44.   - the application that you are interested in has to load an additional
  45.     file every time it starts up.  This doesn't seem to make that much of a
  46.     performance difference, and you might consider this a huge boon to
  47.     usability.  If you are modifying an application's resource database,
  48.     you just need to re-run the application without having to "xrdb" again.
  49.  
  50.   This is all documented in the Xt Specification (pg 125 & 666).
  51.             [Thanks to: Kevin Samborn (samborn@mtkgc.com)
  52.              and Michael Urban (urban@cobra.jpl.nasa.gov) ]
  53.  
  54.   The "comp.windows.x Frequently Asked Questions" FAQ list contains an
  55.   excellent explanation of how these environment variables work.
  56.  
  57.   NOTE: xrdb will by default run your .Xdefaults file through cpp.
  58.     When your resources are split out into multiple resource files
  59.     (as described above) and then loaded by the individual client
  60.     programs, they will NOT be processed first through cpp.
  61.     WATCH OUT FOR THIS!!
  62.  
  63.     I had C style comments in my .Xdefaults file, which cpp
  64.     stripped out.  When I switched to this method of distributed
  65.     resource files I spent several frustrating days trying to
  66.     figure out why my clients were not finding their resources.  Xt
  67.     did *NOT* provide any error message when it encountered those C
  68.     style comments in the resource files, it simply silently
  69.     aborted processing that resource file.
  70.  
  71.     The loss of preprocessing (which can be very handy, e.g. ``#ifdef
  72.     COLOR'' ...) is enough to cause some people to not be interested in
  73.     this method of resource management.
  74.  
  75.   You may also run into some clients which break the rules.  For example,
  76.   neither Emacs (18.58.3) nor Xvt (1.0) will find their resources if they
  77.   are anywhere other than in .Xdefaults.
  78.  
  79.   On other ``gotcha'' to watch out for is starting up a client on a
  80.   machine that does not share files with the machine where your
  81.   resources are stored.   In this case your client will not find its
  82.   resources.  Loading all your resources into the server will guarantee
  83.   that all of your clients will always find their resources.
  84.                                 Casey Leedom (casey@gauss.llnl.gov)
  85.  
  86. Define Your Display Properly
  87. - - - - - - - - - - - - - - -
  88.  
  89.   Client programs are often executed on the same machine as the server.  In
  90.   that situation, rather than setting your DISPLAY environment variable to
  91.   "<hostname>:0.0", where <hostname> is the name of your workstation, you
  92.   should set your DISPLAY variable to "unix:0.0" or ":0.0".  By doing this
  93.   you access optimized routines that know that the server is on the same
  94.   machine and use a shared memory method of transferring requests.
  95.             [thanks to Patrick J Horgan (pjh70@ras.amdahl.com)]
  96.  
  97.   See the _DISPLAY NAMES_ section of the X(1) man page for further
  98.   explanation of how to properly set your display name.
  99.  
  100. -------
  101. Clients
  102. -------
  103.  
  104.   If you only have a few megabytes of Ram then you should think
  105.   carefully about the number of programs you are running.  Think also
  106.   about the _kind_ of programs you are running.  For example:  Is there
  107.   a smaller clock program than xclock?
  108.  
  109.   Unfortunately, I haven't really noticed that programs advertise how large
  110.   they are, so the onus is on us to do the research and spread the word.
  111.  
  112.   [ Suggestions on better alternatives to the some of the standard clients
  113.   (eg: Xclock, Xterm, Xbiff) are welcome.  --ed.]
  114.  
  115.   One thing to note on systems with shared libraries, is that once Xaw,
  116.   Xt, Xlib, etc are loaded, they don't have to be loaded again.  So if
  117.   you already have an Athena program loaded, xclock won't add much to
  118.   the load.  This is an argument against non-Athena programs, that load
  119.   extra code.  The moral of this story is to keep to one set of
  120.   libraries -- don't mix your toolkits (e.g. XView and Xt).
  121.       Duncan Sinclair (sinclair@dcs.gla.ac.uk | sinclair@uk.ac.gla.dcs)
  122.  
  123. A Better Clock for X
  124. - - - - - - - - - - -
  125.  
  126.   Richard Hesketh (rlh2@ukc.ac.uk) :
  127.     xbiff and xclock are written using the X toolkit and are therefore
  128.     rather large ...
  129.  
  130.   Duncan Sinclair (sinclair@dcs.gla.ac.uk) told me about ``xcuckoo'', which
  131.   displays a clock in the title bar of *another* program.  Saves screen real
  132.   estate.  I haven't tried this one out yet.  Find it on export...
  133.  
  134.   der Mouse (mouse@Lightning.McRCIM.McGill.EDU) :
  135.     For your consideration I offer mclock, my clock program.  It is
  136.     non-Xt-based, which alone should help, and is extensively
  137.     configurable:  it can be made to look very much like MIT oclock, or
  138.     mostly like xclock purely by changing resources.
  139.  
  140.     You can get this by anonymous ftp from larry.mcrcim.mcgill.edu
  141.     (132.206.1.1), /X/mclock.shar
  142.  
  143.   I've tried this clock program out, and it works fine, but I haven't tried
  144.   any extensive testing to see how it compares to xclock in resource
  145.   consumption.  One point: don't let the size of the executable fool you.
  146.   The binary on my site is about 2.5 times the size of Xclock, but the
  147.   author pointed out to me that mclock does *not* drag in Xaw, Xmu, or Xt,
  148.   which Xclock does.  Therefore, it should be lighter when running.
  149.  
  150.   Of course, the ultimate clock --- one that consumes no resources, and
  151.   takes up no screen real estate --- is the one that hangs on your wall.
  152.   :-)
  153.  
  154. A Better Terminal Emulator for X
  155. - - - - - - - - - - - - - - - - -
  156.  
  157.   From the README file distributed with xterm:
  158.  
  159.   +-----
  160.   |         Abandon All Hope, Ye Who Enter Here
  161.   |
  162.   | This is undoubtedly the most ugly program in the distribution.
  163.   | ...
  164.   +-----
  165.  
  166.   Ugly maybe, but at my site it's still the most used.  I suspect that
  167.   xterm is one of the most used clients at many, if not most sites.
  168.   Laziness?  Isn't there a better terminal emulator available?  See below.
  169.  
  170.   If you must use xterm, you can try reducing the number of saveLines
  171.   to reduce memory usage.  [ Oliver Jones (oj@roadrunner.pictel.com),
  172.                    Jonny Farringdon (j.farringdon@psychol.ucl.ac.uk) ]
  173.  
  174. 1) Xvt
  175.  
  176.   Richard Hesketh (rlh2@ukc.ac.uk) :
  177.     ... if you don't need all the esoteric features of xterm, then get
  178.     hold of xvt from export.lcs.mit.edu:/contrib/xvt-1.0.tar.Z, it was
  179.     written here just to save swap space as xterm is rather a hog!
  180.  
  181.   I've since obtained and am evaluating 'xvt' and it does seem to me
  182.   to be noticeably faster than xterm, while yet coming off as a full
  183.   featured "clone" of xterm -- you don't even have to rename your xterm
  184.   resources as xvt pretends to be XTerm.  It is missing a few xterm
  185.   features to which I've grown accustomed, but I'm giving it a try.
  186.  
  187. 2) mterm
  188.  
  189.   der Mouse (mouse@Lightning.McRCIM.McGill.EDU) :
  190.     I also have my own terminal emulator.  Its major lack is
  191.     scrollback, but some people like it anyway.  It can be had from [
  192.     larry.mcrcim.mcgill.edu (132.206.1.1) ], in
  193.     /X/mterm.src/mterm.ball-o-wax.
  194.  
  195. -------------------------
  196. Miscellaneous Suggestions
  197. -------------------------
  198.  
  199. Pretty Pictures
  200. - - - - - - - -
  201.  
  202.   One of the things I did when first learning to use X, was experiment with
  203.   using different images as the background on my display.  (via xsetroot, or
  204.   xphoon, etc).  I soon abandoned this practise for some very good reasons:
  205.  
  206.   - The more complicated your root window bitmap, the slower the server
  207.     is at redrawing your screen when you reposition windows (or redraw, etc)
  208.  
  209.   - These take up RAM, and CPU power.  I work on a Sun SPARC ELC with 8mb
  210.     RAM and I'm looking for more power, I can't comprehend it when I see
  211.     people with a 4mb Sun 3/60 running xphoon as their root window.
  212.  
  213.   If you're anything like me, you need all the screen real estate
  214.   that you can get for clients, and so rarely see the root window anyway.
  215.               [ Thanks to Qiang Alex Zhao (azhao@cs.arizona.edu)
  216.             for reminding me of this one. --ed.]
  217. A Quicker Mouse
  218. - - - - - - - -
  219.  
  220.   Using xset, you can adjust how fast your pointer moves on the screen
  221.   when you move your mouse.  I like to be able to send my pointer
  222.   across the screen with just a flick of the wrist, and so I use
  223.   "xset m 5 10" in my .xinitrc file.  See the xset man page for further
  224.   ideas and information.
  225.  
  226.   Hint: sometimes you may want to *slow down* your mouse tracking for
  227.   fine work.  To cover my options, I have placed a number of different
  228.   mouse setting commands into menus in my window manager.
  229.   e.g. (for twm) :
  230.       menu "mouse settings"
  231.       {
  232.         "Mouse Settings:"            f.title
  233.     "  Very Fast"                ! "xset m 7 10 &"
  234.     "  Normal (Fast)"            ! "xset m 5 10 &"
  235.     "  System Default (Un-Accelerated)"    ! "xset m default &"
  236.     "  Glacial"                ! "xset m 0 10 &"
  237.       }
  238.  
  239. Programming Thoughts
  240. - - - - - - - - - - -
  241.  
  242.   Joe English (joe@trystero.art.com) :
  243.     To speed up applications that you're developing, there are tons of
  244.     things you can do.  Some that stick out:
  245.  
  246.     * For Motif programs, don't set XmFontList resources for individual
  247.       buttons, labels, lists, et. al.; use the defaultFontList or
  248.       labelFontList or whatever resource of the highest-level manager
  249.       widget.  Again, stick to as few fonts as possible.
  250.  
  251.     * Better yet, don't use Motif at all.  It's an absolute pig.
  252.  
  253.     * Don't create and destroy widgets on the fly.  Try to reuse them.
  254.       (This will avoid many problems with buggy toolkits, too.)
  255.  
  256.     * Use a line width of 0 in GCs.  On some servers this makes a HUGE
  257.       difference.
  258.  
  259.     * Compress and collapse multiple Expose events.  This can make the
  260.       difference between a fast application and a completely unusable
  261.       one.
  262.  
  263.   Francois Staes (frans@kiwi.uia.ac.be) :
  264.     Just a small remark: I once heard that using a better malloc
  265.     function would greatly increase performance of Xt based
  266.     applications since they use malloc heavily. They suggested trying
  267.     out the GNUY malloc, but I didn't find the time yet. I did some
  268.     tests on small programs just doing malloc and free, and the
  269.     differences were indeed very noticeable ( somewhat 5 times faster)
  270.  
  271.   [ Any confirmation on this from anyone?  --ed.]
  272.  
  273. Say What!?
  274. - - - - - -
  275.  
  276.   Some contributors proposed ideas that seem right off the wall at first:
  277.  
  278.   David B. Lewis (by day: dbl@osf.org, by night: david%craft@uunet.uu.net) :
  279.     How about this: swap displays with someone else. Run all your programs
  280.     on the other machine and display locally; the other user runs off your
  281.     machine onto the other display. Goal: reduce context switches in the
  282.     same operation between client and server.
  283.  
  284.   I'm not in a situation where I can easily try this, but I have received
  285.   the following confirmation...
  286.  
  287.   Michael Salmon (Michael.Salmon@eos.ericsson.se):
  288.     I regularly run programs on other machines and I notice a big
  289.     difference. I try to run on a machine where I will reduce net usage
  290.     and usually with nice to reduce the impact of my intrusion. This
  291.     helps a lot on my poor little SS1+ with only 16 MB, it was
  292.     essential when I only had 8 MB.
  293.  
  294.   Casey Leedom (casey@gauss.llnl.gov) :
  295.     [The X11 Server and the client are] competing for the same CPU as
  296.     your server when you run it on the same machine.  Not really a
  297.     major problem, except that the X11 client and the server are in
  298.     absolute syncronicity and are context thrashing.
  299.  
  300.   Timothy H Panton (thp@westhawk.uucp) :
  301.     Firstly it relies on the fact that most CPU's are mostly idle, X's
  302.     cpu usage is bursty.  so the chances of you and your team-mate
  303.     doing something cpu-intensive at the same time is small. If they
  304.     are not then you get twice the cpu+memory available for your
  305.     action.
  306.  
  307.     The second factor is that context switches are expensive, using 2
  308.     cpu's halves them, you pay a price due to the overhead of going
  309.     over the network, but this is offset in most cases by the improved
  310.     buffering of a network (typically 20k vs 4k for a pipe), allowing
  311.     even fewer context switches.
  312.  
  313. ----------------------------
  314. Other Sources of Information
  315. ----------------------------
  316.  
  317.   Adrian Nye (adrian@ora.com):
  318.     A lot more tips on performance are in the paper "Improving X
  319.     Application Performance" by Chris D. Peterson and Sharon Chang, in
  320.     Issue 3 of The X Resource.
  321.  
  322.     An earlier version of this paper appeared in the Xhibition 1992
  323.     conference proceedings.
  324.  
  325.     This paper is absolutely essential reading for X programmers.
  326.  
  327.   [Seems I've got some competition. :-)  --ed.]
  328.  
  329. --------------
  330. Author & Notes
  331. --------------
  332.   This list is currently maintained by Art Mulder (art@cs.ualberta.ca)
  333.  
  334.   Suggestions, corrections, or submission for inclusion in this list
  335.   are gladly accepted.  Layout suggestions and comments (spelling
  336.   mistak's too! :-) are also welcome.
  337.  
  338.   Currently I have listed all contributors of the various comments and
  339.   suggestions.  If you do not want to be credited, please tell me.
  340.  
  341.   speedup-x-faq is copyright (c) 1992 by Arthur E. Mulder
  342.  
  343.   You may copy this document in whole or in part as long as you don't
  344.   try to make money off it, or pretend that you wrote it.
  345.  
  346. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  347. --
  348.  ...art mulder ( art@cs.ualberta.ca )    | "Do not be conformed to this world,
  349.  Department of Computing Science         |  but be transformed by the renewal
  350.  University of Alberta, Edmonton, Canada |  of your mind, ..."  Romans 12:2
  351.  University of Alberta, Edmonton, Canada |  of your mind, ..."  Romans 12:2
  352.